/*
day140_2
2020.1.15
*/
#include<unordered_map>
#include<string>
#include<iostream>
using namespace std;


class Solution {
public:
    int longestPalindrome(string s) 
	{
        unordered_map<char,int> m;
        int res=0;
        
        for(int i=0;i<s.size();i++)
        {
        	
        	if(m[s[i]] == 0) 
			{
				m[s[i]]++;
			}
        	else
        	{
        		res+=2;
        		m[s[i]]--;
			}
			
		}
		
		
		for(auto &x : m)
		{
			if(x.second==1)	return res+1;
		}
		
		return res;
    }
};

int main()
{
	string s="abccccdd";
	Solution sol;
	cout<<sol.longestPalindrome(s);
	return 0;
 } 

